package com.migu.rbac.test;

import org.apache.commons.codec.digest.DigestUtils;

import java.io.UnsupportedEncodingException;

/**
 * @Author: zhaojie
 * @CreateDate: 2019/11/13
 * @Description:
 */
public class test3333 {

    public static void main(String[] args) {
        String mallUrl = "http://baoxian.itaiping.com/m/product/trialPage?productId=XXX";

        StringBuilder sb = new StringBuilder(mallUrl);
        try {
            String sign = DigestUtils.md5Hex(("privatekey" + "12121" + "1").getBytes("GBK"));
            sb.append("&empNo=a630&merchantId={merchantId}&pUserId={pUserId}&pBusiId={pBusiId}&sign={sign}");
            String replace = sb.toString();
            System.out.println(replace.replace("{merchantId}", "").
                    replace("{pUserId}", "12121").
                    replace("{pBusiId}", "1").
                    replace("{sign}", sign));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
